<template>
	<view class="content">
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area">
			<text class="title">{{title}}</text>
		</view>
		<button @click="start">持续定位</button>
		<button @click="stop">停止定位</button>
		<button @click="destory">销毁定位</button>
		<button @click="permission">检测权限</button>
		<text>{{count }}</text>
	</view>
</template>

<script>
	// const fUN_AmapLocation = uni.requireNativePlugin('FUN-AmapLocation');
	const wxp_AMap = uni.requireNativePlugin('WXP-Amap');
	// const dcRichAlert = uni.requireNativePlugin('DCloud-RichAlert');
	export default {
		data() {
			return {
				title: 'hello',
				count: 0
			}
		},
		methods: {
			permission() {
				wxp_AMap.permission(result => {
					console.log(JSON.stringify(result));
				});
			},
			start() {
				console.log("老铁，给点力好不好？");
				wxp_AMap.start({
					setInterval: 5000
				}, result => {
					console.log(JSON.stringify(result));
					this.count++;
				});
			},
			stop() {
				wxp_AMap.stop(result => console.log(JSON.stringify(result)));
			},
			destory() {
				wxp_AMap.destroy();
			}
		},
		onLoad() {
		},
		onUnload() {
		},
		onShow() {
			
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
